var express = require('express');

var cors = require('cors');

var app = express();

var port = 4004;

app.get('/redirect',(req,res)=>{

    res.redirect('http://www.baidu.com');

})

app.get('/home',cors(),(req,res)=>{

    var data = {
        homeTitle:'home page newnew',
        homeContent:"Test Home content"
    }

    res.send(data)

})

app.get('/about',cors(),(req,res)=>{

    var data = {
        aboutTitle:'about title',
        aboutList:[
            {
                name:'jack',
                id:1
            },{
                name:'kate',
                id:2
            }
        ]
    }

    res.send(data)

})

app.listen(port,()=>{
    console.log('server at '+port);
})